<?php
include("./_common.php");

$val				= $_GET['val'] ? $_GET['val'] : "";
$cate_name	= $_GET['cate_name'] ? $_GET['cate_name'] : "cate_msg";


if(empty($val))
{
	return false;
}

$SQL = "SELECT * FROM " . $g4['category_table'] . "
					WHERE c_depth = '1'
						AND c_pcode = '" . $val . "'
					  AND c_show='1' ";

$result = sql_query($SQL);

$selectbox  = "<select name='" . $cate_name . "' style='height:21px;font-family:Dotum;font-size:12px;'>";
$selectbox .= "<option value='' > -- 이차 선택 --</option> ";

for ($i=0; $row = sql_fetch_array($result); $i++)
{
	if($row['c_code'] == $_val)
	{
		$selected = " selected='selected' ";
	}
	else
	{
		$selected = "";
	}

	$selectbox .= "<option value='" . $row['c_code'] . "' " . $selected . " >" . $row['c_name'] . "</option> ";
}

$selectbox  .= "</select>";

echo $selectbox;
?>